import { behavior as computedBehavior } from 'miniprogram-computed'

Component({
  behaviors: [computedBehavior],
  styleIsolation: 'apply-shared',
  properties: {
    label: String,
    openType: String,
    size: String,
    outline: Boolean,
    disabled: Boolean,
    flat: Boolean,
    color: String,
    fontColor: String,
    icon: String,
    iconClass: String
  },
  computed: {
    btnStyle(data) {
      const { color, fontColor, outline, flat } = data
      if (!color && !fontColor) return ''
      if (outline) {
        return `border-color: ${color};color:${fontColor || color}`
      } else if (flat) {
        return `color:${fontColor || color}`
      } else {
        return `background: ${color};color: ${fontColor};box-shadow: none;`;
      }
    }
  },
  methods: {
    bindgetphonenumber(e) {
      this.triggerEvent('getphonenumber', e.detail)
    },
    async onTap(e) {
      // console.log(111342)
      // this.triggerEvent('tap', e)
    }
  }
})
